// javamaps
// Copyright (c) 2010 Lup Gratian
package Rendering;
import Rendering.Utils.*;

public abstract class AnimationBase {
    protected IAnimatable parent_;
    protected IInterpolation interpolation_;
    protected Stopwatch watch_;

    /*
     * Constructori.
     */
    public AnimationBase(IAnimatable parent, long duration,
                         IInterpolation interpolation) {
        parent_ = parent;
        interpolation_ = interpolation;
        watch_ = new Stopwatch(duration);
    }

    /*
     * Metode protected.
     */
    protected void StartWatch() { watch_.Start(); }
    protected void StopWatch() { watch_.Start(); }

    /*
     * Metode publice.
     */
    public IAnimatable Parent() { return parent_; }
    public boolean Completed() { return watch_.Completed(); }
    public double Progress() { return watch_.Progress(); }
    public long Duration() { return watch_.Duration(); }
    public IInterpolation Interpolation() { return interpolation_; }

    /*
     * Metode abstracte (trebuie implementate de fiecare animatie in parte).
     */
    public abstract void Update();
    public abstract void Start();
}